package com.example.bbgds.test.dao;

import android.content.Context;

/**
 * Created by bbgds on 2016/3/23.
 */
public class DbHelp {
    private static DaoSession sDaoSession;

    public static DaoSession getDaoSession(Context context) {
        if(sDaoSession == null){
            DaoMaster.DevOpenHelper helper = new DaoMaster.DevOpenHelper(context, "notes-db", null);
            // 注意：该数据库连接属于 DaoMaster，所以多个 Session 指的是相同的数据库连接。
            DaoMaster daoMaster = new DaoMaster(helper.getWritableDatabase());
            sDaoSession = daoMaster.newSession();
        }
        return sDaoSession;
    }
}
